package seismosurfer.servlets.util;

import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;

import seismosurfer.database.DB;

/**
 * A ServletRequestListener that is used to
 * start and end tasks related to a HTTP request.
 *
 */
public class RequestListener implements ServletRequestListener {
    public RequestListener() {
    }

    public void requestDestroyed(ServletRequestEvent servletRequestEvent) {
        DB.closeConnection();
    }

    public void requestInitialized(ServletRequestEvent servletRequestEvent) {
        DB.openConnection();
    }
}